{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.convolutional import Conv2D\n",
    "from keras import backend as K\n",
    "import json\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Conv2D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.0] 4 3x3 filters on 5x5x2 input, strides=(1,1), padding='valid', data_format='channels_last', dilation_rate=(1,1), activation='linear', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.08681, -0.443261, -0.150965, 0.689552, -0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718, -0.290409, -0.31962, -0.643838, -0.524612, -0.910275, 0.010863, -0.247495, 0.185611, 0.259884, -0.714799, 0.867683, 0.89276, 0.204593, -0.224467, -0.273624, -0.591309, -0.44647, -0.506928]\n",
      "b shape: (4,)\n",
      "b: [0.08681, -0.443261, -0.150965, 0.689552]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [-0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718]\n",
      "out shape: (3, 3, 4)\n",
      "out: [1.881068, 1.507598, -0.426481, 0.981946, -1.295304, -2.802102, -3.379112, 1.371861, -0.618295, -0.672642, 0.74116, -0.092843, 1.342198, -0.536709, -0.195162, -1.44153, -1.020649, 3.006844, 0.951307, 0.750237, -0.934043, -0.375223, -1.075853, 2.961483, 0.996103, -2.28647, -2.774244, 0.264827, -0.138134, 2.738469, 0.662859, -2.902778, -0.663609, -1.414437, -4.081861, 0.236701]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='linear', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(100)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.0'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.1] 4 3x3 filters on 5x5x2 input, strides=(1,1), padding='valid', data_format='channels_last', dilation_rate=(1,1), activation='linear', use_bias=False**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.032797, 0.141335, -0.943052, -0.656957, 0.370554, 0.667794, -0.386068, 0.787226, 0.443088, -0.620122, 0.108455, -0.295736, -0.636215, 0.571204, 0.930966, -0.535293, -0.832877, 0.207097, 0.457986, -0.447522, 0.370613, 0.035735, -0.903031, -0.724262, -0.626065, 0.988636, 0.041331, 0.157579, 0.469638, 0.083924, 0.826307, 0.61584, -0.194004, -0.285551, 0.905753, -0.312737, 0.7302, 0.660555, 0.076323, 0.844939, -0.805707, -0.794305, 0.403015, 0.78096, -0.680879, -0.448855, 0.344983, -0.671394, 0.402742, -0.02473, 0.361356, 0.043096, -0.913207, -0.552127, 0.15041, -0.759133, 0.000233, -0.723981, -0.894383, -0.643446, -0.115264, 0.755175, 0.898528, -0.043665, -0.077761, 0.274578, -0.350784, -0.764844, -0.897798, 0.275317, 0.624532, 0.340521]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [0.303535, -0.150862, 0.313191, -0.581677, 0.319849, 0.059247, 0.497041, -0.812486, 0.569044, 0.374484, 0.390157, -0.006267, 0.950722, -0.592945, -0.401959, -0.544688, -0.903662, 0.807943, -0.839793, 0.214433, 0.261693, -0.244116, -0.973518, 0.684439, -0.230125, 0.103332, 0.421076, 0.350558, 0.389129, -0.315086, -0.175219, -0.520418, 0.937672, -0.422886, -0.705377, -0.741319, 0.888112, -0.297131, 0.467135, 0.827779, 0.401975, -0.222937, 0.884519, 0.472983, -0.523071, 0.647547, 0.521227, -0.210582, -0.599624, 0.425193]\n",
      "out shape: (3, 3, 4)\n",
      "out: [0.222896, 1.085101, 1.523122, 0.029914, -3.208341, 0.668446, 0.159679, -2.842651, 1.751455, 0.291729, -3.055066, -1.414293, 2.641148, -0.979586, -3.159912, 0.963647, 2.551851, -1.421387, -2.003495, -0.273587, -0.434787, 0.075452, 0.122831, 0.496359, -0.500578, 0.818305, 0.353606, -1.248895, -1.872087, 1.321958, 0.976701, 0.640393, -2.795104, -2.835678, 1.354631, -1.54993]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='linear', use_bias=False)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(101)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.1'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.2] 4 3x3 filters on 5x5x2 input, strides=(2,2), padding='valid', data_format='channels_last', dilation_rate=(1,1), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.195363, 0.351974, -0.401437, 0.461481, 0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641]\n",
      "b shape: (4,)\n",
      "b: [0.195363, 0.351974, -0.401437, 0.461481]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286]\n",
      "out shape: (2, 2, 4)\n",
      "out: [0.20599, 0.342823, 0.742175, 0.0, 0.815729, 2.184798, 1.251954, 0.0, 0.0, 0.0, 1.112864, 0.010656, 0.731076, 0.0, 0.855229, 0.0]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(2,2), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(102)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.2'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.3] 5 4x4 filters on 7x7x3 input, strides=(2,1), padding='valid', data_format='channels_last', dilation_rate=(1,1), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (4, 4, 3, 5)\n",
      "W: [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622, -0.014887, 0.081443, -0.873841, -0.178904, 0.779569, 0.836992, -0.238607, 0.944873, -0.037027, 0.774056, -0.735437, -0.253303, 0.60782, -0.992794, -0.798253, -0.273809, -0.777994, -0.466779, 0.512164, 0.312941, 0.447827, -0.619183, -0.679821, 0.28787, 0.256291, -0.157439, -0.23489, 0.178363, 0.477582, -0.679932, -0.698904, -0.04713, -0.596417, 0.683988, 0.128674, 0.14461, -0.053412, -0.598701, -0.28704, -0.083479, 0.252272, -0.817686, 0.195913, -0.564344, -0.987454, 0.1461, -0.206776, 0.336421, 0.457537, -0.656402, 0.828352, -0.410226, 0.319745, -0.742681, -0.203616, 0.331785, 0.514347, -0.517425, -0.796471, 0.25001, -0.495738, -0.667485, 0.156551, 0.958574, -0.644056, 0.765525, -0.200055, -0.415118, -0.292941, -0.599639, 0.416564, -0.366227, 0.181605, 0.062272, -0.277941, -0.991833, 0.459158, 0.237737, -0.007369, -0.433549, 0.091637, -0.048628, 0.386804, 0.402629, -0.215112, -0.178129, -0.974124, 0.785804, -0.987586, -0.342624, 0.042113, -0.991281, -0.011006, -0.075192, -0.375827, -0.229347]\n",
      "b shape: (5,)\n",
      "b: [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343]\n",
      "\n",
      "in shape: (7, 7, 3)\n",
      "in: [-0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622, -0.014887, 0.081443, -0.873841, -0.178904, 0.779569, 0.836992, -0.238607, 0.944873]\n",
      "out shape: (2, 4, 5)\n",
      "out: [0.0, 0.0, 3.453939, 0.0, 1.228864, 0.0, 0.469417, 0.0, 0.0, 2.662399, 0.0526, 0.0, 0.0, 0.0, 4.369679, 0.0, 0.0, 0.0, 3.251074, 0.602914, 0.0, 4.518651, 0.0, 2.820123, 1.26282, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.960698, 1.478059, 0.0, 0.0, 1.973457, 0.620029, 0.0, 0.0, 3.609938]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (7, 7, 3)\n",
    "conv = Conv2D(5, (4,4), strides=(2,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(103)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.3'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.4] 4 3x3 filters on 5x5x2 input, strides=(1,1), padding='same', data_format='channels_last', dilation_rate=(1,1), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [-0.704159, -0.543403, 0.614987, -0.403051, -0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234]\n",
      "b shape: (4,)\n",
      "b: [-0.704159, -0.543403, 0.614987, -0.403051]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [-0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417]\n",
      "out shape: (5, 5, 4)\n",
      "out: [0.0, 1.245447, 1.285421, 0.0, 0.0, 0.359707, 1.273985, 0.0, 0.0, 0.0, 0.361441, 0.0, 0.0, 0.0, 0.0, 0.0, 0.814408, 0.0, 1.297703, 0.455072, 0.0, 0.045489, 0.0, 0.324618, 0.0, 0.74526, 0.0, 0.661333, 0.0, 0.0, 0.778435, 1.990949, 0.0, 0.0, 1.025771, 2.929728, 0.0, 0.0, 1.189183, 0.0, 0.0, 0.0, 2.123506, 0.0, 0.526918, 0.0, 2.237533, 0.0, 0.0, 0.0, 1.200334, 1.153394, 0.0, 0.0, 0.0, 4.087014, 0.0, 1.205699, 0.0, 1.322062, 0.159978, 0.037334, 0.0, 0.0, 0.0, 0.0, 0.4114, 0.0, 0.558253, 0.0, 0.0, 0.245042, 0.063338, 0.0, 0.433151, 0.396075, 0.39434, 0.0, 0.433619, 1.579658, 0.0, 0.0, 1.226101, 0.782336, 0.542313, 0.515257, 0.0, 0.0, 0.0, 0.0, 2.093277, 0.652337, 0.0, 0.0, 0.944013, 0.0, 0.306167, 0.0, 0.922607, 2.145665]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='same',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(104)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.4'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.5] 4 3x3 filters on 4x4x2 input, strides=(2,2), padding='same', data_format='channels_last', dilation_rate=(1,1), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [-0.83252, -0.332987, 0.718711, -0.788626, 0.07128, -0.872621, -0.406331, -0.99551, -0.097768, 0.767239, 0.154115, -0.502245, -0.316894, -0.859603, 0.076951, 0.050967, 0.637593, 0.372661, 0.261934, -0.259222, 0.072217, -0.653676, -0.668125, -0.779061, -0.348294, 0.794828, 0.096874, -0.517259, -0.343993, 0.177857, 0.590341, -0.037656, 0.152372, 0.180228, 0.595796, 0.556247, 0.333295, 0.022451, 0.07271, -0.653556, 0.35149, 0.816316, 0.070974, -0.631558, -0.817281, 0.142117, 0.649301, -0.685559, 0.317358, -0.816128, 0.896987, -0.808449, -0.141181, 0.254, 0.540822, -0.053505, -0.440647, -0.503204, -0.804487, 0.509112, 0.050405, 0.601983, -0.385832, 0.238291, 0.998461, 0.496045, 0.077139, -0.153403, -0.960801, 0.630448, -0.808006, -0.801654]\n",
      "b shape: (4,)\n",
      "b: [-0.83252, -0.332987, 0.718711, -0.788626]\n",
      "\n",
      "in shape: (4, 4, 2)\n",
      "in: [0.07128, -0.872621, -0.406331, -0.99551, -0.097768, 0.767239, 0.154115, -0.502245, -0.316894, -0.859603, 0.076951, 0.050967, 0.637593, 0.372661, 0.261934, -0.259222, 0.072217, -0.653676, -0.668125, -0.779061, -0.348294, 0.794828, 0.096874, -0.517259, -0.343993, 0.177857, 0.590341, -0.037656, 0.152372, 0.180228, 0.595796, 0.556247]\n",
      "out shape: (2, 2, 4)\n",
      "out: [0.0, 0.565042, 0.12593, 0.0, 0.0, 0.320489, 0.979856, 0.0, 0.0, 0.0, 0.799525, 0.0, 0.0, 0.0, 0.637126, 0.0]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (4, 4, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(2,2), padding='same',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(105)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.5'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.6] 4 3x3 filters on 6x3x1 input, strides=(3,2), padding='same', data_format='channels_last', dilation_rate=(1,1), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 1, 4)\n",
      "W: [-0.98287, 0.908613, -0.10087, 0.220438, 0.70412, 0.47762, 0.948863, 0.714924, 0.710821, 0.719052, -0.295442, -0.575936, 0.560889, 0.798823, -0.904521, -0.725105, -0.647339, -0.926505, 0.020986, 0.534159, -0.030523, -0.580772, -0.162302, 0.128018, -0.216971, 0.026925, 0.392296, 0.991634, 0.214941, 0.639493, -0.574398, -0.430476, -0.117988, -0.261311, -0.808084, -0.466051]\n",
      "b shape: (4,)\n",
      "b: [-0.98287, 0.908613, -0.10087, 0.220438]\n",
      "\n",
      "in shape: (6, 3, 1)\n",
      "in: [0.70412, 0.47762, 0.948863, 0.714924, 0.710821, 0.719052, -0.295442, -0.575936, 0.560889, 0.798823, -0.904521, -0.725105, -0.647339, -0.926505, 0.020986, 0.534159, -0.030523, -0.580772]\n",
      "out shape: (2, 2, 4)\n",
      "out: [0.0, 0.474708, 0.960876, 1.317228, 0.0, 2.040575, 0.0, 0.060188, 0.0, 2.127169, 0.77897, 0.632372, 0.0, 0.0, 0.462447, 0.405417]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 3, 1)\n",
    "conv = Conv2D(4, (3,3), strides=(3,2), padding='same',\n",
    "              data_format='channels_last', dilation_rate=(1,1),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(106)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.6'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.7] 4 3x3 filters on 5x5x2 input, strides=(1,1), padding='valid', data_format='channels_last', dilation_rate=(2,2), activation='linear', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.08681, -0.443261, -0.150965, 0.689552, -0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718, -0.290409, -0.31962, -0.643838, -0.524612, -0.910275, 0.010863, -0.247495, 0.185611, 0.259884, -0.714799, 0.867683, 0.89276, 0.204593, -0.224467, -0.273624, -0.591309, -0.44647, -0.506928]\n",
      "b shape: (4,)\n",
      "b: [0.08681, -0.443261, -0.150965, 0.689552]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [-0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718]\n",
      "out shape: (1, 1, 4)\n",
      "out: [-0.449265, 0.56076, -2.92837, 1.056555]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(2,2),\n",
    "              activation='linear', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(100)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.7'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.8] 4 3x3 filters on 5x5x2 input, strides=(1,1), padding='valid', data_format='channels_last', dilation_rate=(2,2), activation='linear', use_bias=False**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.032797, 0.141335, -0.943052, -0.656957, 0.370554, 0.667794, -0.386068, 0.787226, 0.443088, -0.620122, 0.108455, -0.295736, -0.636215, 0.571204, 0.930966, -0.535293, -0.832877, 0.207097, 0.457986, -0.447522, 0.370613, 0.035735, -0.903031, -0.724262, -0.626065, 0.988636, 0.041331, 0.157579, 0.469638, 0.083924, 0.826307, 0.61584, -0.194004, -0.285551, 0.905753, -0.312737, 0.7302, 0.660555, 0.076323, 0.844939, -0.805707, -0.794305, 0.403015, 0.78096, -0.680879, -0.448855, 0.344983, -0.671394, 0.402742, -0.02473, 0.361356, 0.043096, -0.913207, -0.552127, 0.15041, -0.759133, 0.000233, -0.723981, -0.894383, -0.643446, -0.115264, 0.755175, 0.898528, -0.043665, -0.077761, 0.274578, -0.350784, -0.764844, -0.897798, 0.275317, 0.624532, 0.340521]\n",
      "\n",
      "in shape: (5, 5, 2)\n",
      "in: [0.303535, -0.150862, 0.313191, -0.581677, 0.319849, 0.059247, 0.497041, -0.812486, 0.569044, 0.374484, 0.390157, -0.006267, 0.950722, -0.592945, -0.401959, -0.544688, -0.903662, 0.807943, -0.839793, 0.214433, 0.261693, -0.244116, -0.973518, 0.684439, -0.230125, 0.103332, 0.421076, 0.350558, 0.389129, -0.315086, -0.175219, -0.520418, 0.937672, -0.422886, -0.705377, -0.741319, 0.888112, -0.297131, 0.467135, 0.827779, 0.401975, -0.222937, 0.884519, 0.472983, -0.523071, 0.647547, 0.521227, -0.210582, -0.599624, 0.425193]\n",
      "out shape: (1, 1, 4)\n",
      "out: [-0.578839, 1.046696, 1.078234, 0.69352]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 5, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(2,2),\n",
    "              activation='linear', use_bias=False)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(101)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.8'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.9] 4 3x3 filters on 7x7x2 input, strides=(1,1), padding='valid', data_format='channels_last', dilation_rate=(3,3), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [0.195363, 0.351974, -0.401437, 0.461481, 0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641]\n",
      "b shape: (4,)\n",
      "b: [0.195363, 0.351974, -0.401437, 0.461481]\n",
      "\n",
      "in shape: (7, 7, 2)\n",
      "in: [0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641, -0.221058, -0.27166, -0.014907, -0.92768, -0.54906, -0.731149, 0.600323, 0.352064, -0.730288, 0.065041, 0.53791, -0.398966, -0.180102, -0.233353, 0.95265, 0.076114, 0.820989, -0.637627, -0.434933, -0.836859, -0.781756, 0.2022, 0.420213, -0.359623, 0.460477, 0.643565, -0.143274, -0.63885, -0.803257, 0.287415]\n",
      "out shape: (1, 1, 4)\n",
      "out: [0.0, 2.241294, 0.0, 1.107507]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (7, 7, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='valid',\n",
    "              data_format='channels_last', dilation_rate=(3,3),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(102)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.9'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.10] 3 4x4 filters on 4x8x3 input, strides=(1,1), padding='same', data_format='channels_last', dilation_rate=(2,2), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (4, 4, 3, 3)\n",
      "W: [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622]\n",
      "b shape: (3,)\n",
      "b: [-0.135778, -0.651569, -0.658113]\n",
      "\n",
      "in shape: (4, 8, 3)\n",
      "in: [0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698]\n",
      "out shape: (4, 8, 3)\n",
      "out: [1.131317, 0.0, 0.0, 0.809904, 0.0, 0.0, 0.056086, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.251846, 0.0, 0.650556, 0.628197, 0.0, 0.0, 1.029379, 0.0, 2.939306, 0.23459, 0.0, 0.385831, 0.0, 0.0, 1.017464, 0.18825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.247988, 0.083916, 0.0, 0.0, 0.202801, 0.0, 0.137876, 1.309465, 0.0, 0.0, 0.969843, 0.531891, 0.0, 0.0, 0.06576, 0.0, 0.0, 0.0, 0.0, 0.096874, 0.0, 1.147747, 0.0, 0.0, 0.155811, 0.0, 0.331866, 0.0, 0.319746, 0.0, 0.0, 0.0, 0.0, 1.384199, 0.0, 1.856335, 0.0, 1.686605, 0.0, 0.0, 0.0, 0.0, 0.0, 1.802758, 0.0, 0.0, 0.0, 0.102891, 0.0, 0.0, 1.089357, 0.617667, 0.0, 0.0, 0.543751]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (4, 8, 3)\n",
    "conv = Conv2D(3, (4,4), strides=(1,1), padding='same',\n",
    "              data_format='channels_last', dilation_rate=(2,2),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(103)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.10'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[convolutional.Conv2D.11] 4 3x3 filters on 8x8x2 input, strides=(1,1), padding='same', data_format='channels_last', dilation_rate=(4,4), activation='relu', use_bias=True**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "W shape: (3, 3, 2, 4)\n",
      "W: [-0.704159, -0.543403, 0.614987, -0.403051, -0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234]\n",
      "b shape: (4,)\n",
      "b: [-0.704159, -0.543403, 0.614987, -0.403051]\n",
      "\n",
      "in shape: (8, 8, 2)\n",
      "in: [-0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234, -0.611808, 0.138739, 0.526129, -0.170329, 0.504868, -0.454139, 0.245234, 0.479283, 0.651594, -0.447885, -0.78716, -0.537367, -0.578885, -0.3999, -0.981424, 0.584097, -0.461375, 0.948907, 0.763872, -0.720626, -0.572361, 0.780094, -0.385637, 0.90998, -0.697513, 0.366373, -0.427147, 0.423096, -0.55829, 0.769474, -0.484912, -0.731131, -0.794623, 0.19042, 0.537997, -0.390004, -0.697993, -0.710914, -0.222541, -0.375822, 0.236956, -0.978421, -0.834872, 0.29127, 0.125375, 0.82053, 0.953645, 0.931806, 0.170904, -0.474968, -0.266042, -0.021253, 0.449315, 0.266589, 0.405989, 0.663497, 0.762836, -0.421562, 0.664906, 0.130767]\n",
      "out shape: (8, 8, 4)\n",
      "out: [1.008111, 0.862141, 1.53732, 0.0, 0.0, 0.0, 2.278924, 0.0, 0.192175, 0.256028, 1.00272, 0.0, 0.0, 0.0, 0.0, 1.28356, 0.0, 0.0, 1.295987, 0.0, 0.0, 0.0, 0.522589, 0.0, 0.0, 0.0, 1.593745, 0.0, 0.094799, 1.375385, 1.350499, 0.637961, 0.0, 0.393093, 1.508163, 1.045792, 0.0, 0.580916, 0.774659, 0.0, 0.0, 0.0, 1.090937, 0.2098, 0.0, 0.0, 0.706958, 0.948835, 0.0, 0.0, 0.70246, 1.233015, 0.0, 0.0, 0.0, 0.0, 0.0, 0.237716, 0.150121, 0.0, 0.012937, 1.067614, 0.259571, 0.895802, 0.0, 0.127769, 0.0, 0.0, 0.0, 0.0, 0.0, 0.517957, 0.0, 0.0, 0.524233, 0.079491, 0.0, 0.0, 0.0, 1.424679, 0.0, 0.0, 0.798433, 0.0, 0.752754, 0.49452, 0.564184, 1.320468, 0.0, 0.0, 1.469927, 0.075539, 0.0, 0.760117, 0.0, 0.961547, 0.938599, 1.264279, 0.857871, 0.0, 0.114331, 0.0, 0.753579, 0.0, 0.0, 0.0, 0.020539, 0.0, 0.0, 0.0, 1.035394, 0.0, 0.0, 0.0, 0.745973, 0.0, 0.0, 0.070491, 0.0, 0.0, 0.0, 0.0, 0.308166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.911015, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.178493, 1.44698, 0.0, 0.0, 0.0, 1.45985, 0.298695, 0.0, 0.0, 0.0, 0.0, 0.0, 0.402046, 0.536043, 1.160239, 0.0, 0.0, 0.0, 0.0, 0.575623, 0.009206, 0.639194, 0.0, 0.353097, 0.0, 0.471996, 0.411527, 1.148312, 0.966958, 1.172197, 0.0, 0.419191, 0.0, 2.142206, 0.0, 0.0, 0.0, 0.0, 0.0, 0.508378, 0.0, 1.110668, 1.82902, 0.0, 0.0, 2.081267, 0.05382, 0.0, 0.0, 1.5163, 1.476838, 1.364327, 0.033732, 1.076706, 0.609169, 0.0, 0.149234, 2.181282, 0.780896, 0.0, 0.0, 0.763411, 0.0, 0.0, 0.0, 2.053607, 0.12022, 0.0, 0.0, 0.0, 0.29116, 0.0, 0.0, 0.656705, 0.0, 0.0, 0.0, 1.055828, 0.634612, 0.0, 0.0, 0.0, 0.363467, 1.779839, 0.0, 1.270641, 0.15881, 0.0, 0.020913, 0.854418, 0.0, 0.0, 0.0, 0.436751, 0.0, 0.0, 0.0, 0.0, 0.0, 0.436203, 0.236268, 0.0, 0.0, 0.0, 0.0, 0.189446, 0.0, 0.0, 0.0, 0.827813, 0.0, 0.0, 0.0, 0.31375, 0.0, 0.0, 0.0, 0.755046, 0.0]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (8, 8, 2)\n",
    "conv = Conv2D(4, (3,3), strides=(1,1), padding='same',\n",
    "              data_format='channels_last', dilation_rate=(4,4),\n",
    "              activation='relu', use_bias=True)\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = conv(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for w in model.get_weights():\n",
    "    np.random.seed(104)\n",
    "    weights.append(2 * np.random.random(w.shape) - 1)\n",
    "model.set_weights(weights)\n",
    "print('W shape:', weights[0].shape)\n",
    "print('W:', format_decimal(weights[0].ravel().tolist()))\n",
    "print('b shape:', weights[1].shape)\n",
    "print('b:', format_decimal(weights[1].ravel().tolist()))\n",
    "\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['convolutional.Conv2D.11'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../../test/data/layers/convolutional/Conv2D.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"convolutional.Conv2D.0\": {\"input\": {\"data\": [-0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [0.08681, -0.443261, -0.150965, 0.689552, -0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718, -0.290409, -0.31962, -0.643838, -0.524612, -0.910275, 0.010863, -0.247495, 0.185611, 0.259884, -0.714799, 0.867683, 0.89276, 0.204593, -0.224467, -0.273624, -0.591309, -0.44647, -0.506928], \"shape\": [3, 3, 2, 4]}, {\"data\": [0.08681, -0.443261, -0.150965, 0.689552], \"shape\": [4]}], \"expected\": {\"data\": [1.881068, 1.507598, -0.426481, 0.981946, -1.295304, -2.802102, -3.379112, 1.371861, -0.618295, -0.672642, 0.74116, -0.092843, 1.342198, -0.536709, -0.195162, -1.44153, -1.020649, 3.006844, 0.951307, 0.750237, -0.934043, -0.375223, -1.075853, 2.961483, 0.996103, -2.28647, -2.774244, 0.264827, -0.138134, 2.738469, 0.662859, -2.902778, -0.663609, -1.414437, -4.081861, 0.236701], \"shape\": [3, 3, 4]}}, \"convolutional.Conv2D.1\": {\"input\": {\"data\": [0.303535, -0.150862, 0.313191, -0.581677, 0.319849, 0.059247, 0.497041, -0.812486, 0.569044, 0.374484, 0.390157, -0.006267, 0.950722, -0.592945, -0.401959, -0.544688, -0.903662, 0.807943, -0.839793, 0.214433, 0.261693, -0.244116, -0.973518, 0.684439, -0.230125, 0.103332, 0.421076, 0.350558, 0.389129, -0.315086, -0.175219, -0.520418, 0.937672, -0.422886, -0.705377, -0.741319, 0.888112, -0.297131, 0.467135, 0.827779, 0.401975, -0.222937, 0.884519, 0.472983, -0.523071, 0.647547, 0.521227, -0.210582, -0.599624, 0.425193], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [0.032797, 0.141335, -0.943052, -0.656957, 0.370554, 0.667794, -0.386068, 0.787226, 0.443088, -0.620122, 0.108455, -0.295736, -0.636215, 0.571204, 0.930966, -0.535293, -0.832877, 0.207097, 0.457986, -0.447522, 0.370613, 0.035735, -0.903031, -0.724262, -0.626065, 0.988636, 0.041331, 0.157579, 0.469638, 0.083924, 0.826307, 0.61584, -0.194004, -0.285551, 0.905753, -0.312737, 0.7302, 0.660555, 0.076323, 0.844939, -0.805707, -0.794305, 0.403015, 0.78096, -0.680879, -0.448855, 0.344983, -0.671394, 0.402742, -0.02473, 0.361356, 0.043096, -0.913207, -0.552127, 0.15041, -0.759133, 0.000233, -0.723981, -0.894383, -0.643446, -0.115264, 0.755175, 0.898528, -0.043665, -0.077761, 0.274578, -0.350784, -0.764844, -0.897798, 0.275317, 0.624532, 0.340521], \"shape\": [3, 3, 2, 4]}], \"expected\": {\"data\": [0.222896, 1.085101, 1.523122, 0.029914, -3.208341, 0.668446, 0.159679, -2.842651, 1.751455, 0.291729, -3.055066, -1.414293, 2.641148, -0.979586, -3.159912, 0.963647, 2.551851, -1.421387, -2.003495, -0.273587, -0.434787, 0.075452, 0.122831, 0.496359, -0.500578, 0.818305, 0.353606, -1.248895, -1.872087, 1.321958, 0.976701, 0.640393, -2.795104, -2.835678, 1.354631, -1.54993], \"shape\": [3, 3, 4]}}, \"convolutional.Conv2D.2\": {\"input\": {\"data\": [0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [0.195363, 0.351974, -0.401437, 0.461481, 0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641], \"shape\": [3, 3, 2, 4]}, {\"data\": [0.195363, 0.351974, -0.401437, 0.461481], \"shape\": [4]}], \"expected\": {\"data\": [0.20599, 0.342823, 0.742175, 0.0, 0.815729, 2.184798, 1.251954, 0.0, 0.0, 0.0, 1.112864, 0.010656, 0.731076, 0.0, 0.855229, 0.0], \"shape\": [2, 2, 4]}}, \"convolutional.Conv2D.3\": {\"input\": {\"data\": [-0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622, -0.014887, 0.081443, -0.873841, -0.178904, 0.779569, 0.836992, -0.238607, 0.944873], \"shape\": [7, 7, 3]}, \"weights\": [{\"data\": [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622, -0.014887, 0.081443, -0.873841, -0.178904, 0.779569, 0.836992, -0.238607, 0.944873, -0.037027, 0.774056, -0.735437, -0.253303, 0.60782, -0.992794, -0.798253, -0.273809, -0.777994, -0.466779, 0.512164, 0.312941, 0.447827, -0.619183, -0.679821, 0.28787, 0.256291, -0.157439, -0.23489, 0.178363, 0.477582, -0.679932, -0.698904, -0.04713, -0.596417, 0.683988, 0.128674, 0.14461, -0.053412, -0.598701, -0.28704, -0.083479, 0.252272, -0.817686, 0.195913, -0.564344, -0.987454, 0.1461, -0.206776, 0.336421, 0.457537, -0.656402, 0.828352, -0.410226, 0.319745, -0.742681, -0.203616, 0.331785, 0.514347, -0.517425, -0.796471, 0.25001, -0.495738, -0.667485, 0.156551, 0.958574, -0.644056, 0.765525, -0.200055, -0.415118, -0.292941, -0.599639, 0.416564, -0.366227, 0.181605, 0.062272, -0.277941, -0.991833, 0.459158, 0.237737, -0.007369, -0.433549, 0.091637, -0.048628, 0.386804, 0.402629, -0.215112, -0.178129, -0.974124, 0.785804, -0.987586, -0.342624, 0.042113, -0.991281, -0.011006, -0.075192, -0.375827, -0.229347], \"shape\": [4, 4, 3, 5]}, {\"data\": [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343], \"shape\": [5]}], \"expected\": {\"data\": [0.0, 0.0, 3.453939, 0.0, 1.228864, 0.0, 0.469417, 0.0, 0.0, 2.662399, 0.0526, 0.0, 0.0, 0.0, 4.369679, 0.0, 0.0, 0.0, 3.251074, 0.602914, 0.0, 4.518651, 0.0, 2.820123, 1.26282, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.960698, 1.478059, 0.0, 0.0, 1.973457, 0.620029, 0.0, 0.0, 3.609938], \"shape\": [2, 4, 5]}}, \"convolutional.Conv2D.4\": {\"input\": {\"data\": [-0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [-0.704159, -0.543403, 0.614987, -0.403051, -0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234], \"shape\": [3, 3, 2, 4]}, {\"data\": [-0.704159, -0.543403, 0.614987, -0.403051], \"shape\": [4]}], \"expected\": {\"data\": [0.0, 1.245447, 1.285421, 0.0, 0.0, 0.359707, 1.273985, 0.0, 0.0, 0.0, 0.361441, 0.0, 0.0, 0.0, 0.0, 0.0, 0.814408, 0.0, 1.297703, 0.455072, 0.0, 0.045489, 0.0, 0.324618, 0.0, 0.74526, 0.0, 0.661333, 0.0, 0.0, 0.778435, 1.990949, 0.0, 0.0, 1.025771, 2.929728, 0.0, 0.0, 1.189183, 0.0, 0.0, 0.0, 2.123506, 0.0, 0.526918, 0.0, 2.237533, 0.0, 0.0, 0.0, 1.200334, 1.153394, 0.0, 0.0, 0.0, 4.087014, 0.0, 1.205699, 0.0, 1.322062, 0.159978, 0.037334, 0.0, 0.0, 0.0, 0.0, 0.4114, 0.0, 0.558253, 0.0, 0.0, 0.245042, 0.063338, 0.0, 0.433151, 0.396075, 0.39434, 0.0, 0.433619, 1.579658, 0.0, 0.0, 1.226101, 0.782336, 0.542313, 0.515257, 0.0, 0.0, 0.0, 0.0, 2.093277, 0.652337, 0.0, 0.0, 0.944013, 0.0, 0.306167, 0.0, 0.922607, 2.145665], \"shape\": [5, 5, 4]}}, \"convolutional.Conv2D.5\": {\"input\": {\"data\": [0.07128, -0.872621, -0.406331, -0.99551, -0.097768, 0.767239, 0.154115, -0.502245, -0.316894, -0.859603, 0.076951, 0.050967, 0.637593, 0.372661, 0.261934, -0.259222, 0.072217, -0.653676, -0.668125, -0.779061, -0.348294, 0.794828, 0.096874, -0.517259, -0.343993, 0.177857, 0.590341, -0.037656, 0.152372, 0.180228, 0.595796, 0.556247], \"shape\": [4, 4, 2]}, \"weights\": [{\"data\": [-0.83252, -0.332987, 0.718711, -0.788626, 0.07128, -0.872621, -0.406331, -0.99551, -0.097768, 0.767239, 0.154115, -0.502245, -0.316894, -0.859603, 0.076951, 0.050967, 0.637593, 0.372661, 0.261934, -0.259222, 0.072217, -0.653676, -0.668125, -0.779061, -0.348294, 0.794828, 0.096874, -0.517259, -0.343993, 0.177857, 0.590341, -0.037656, 0.152372, 0.180228, 0.595796, 0.556247, 0.333295, 0.022451, 0.07271, -0.653556, 0.35149, 0.816316, 0.070974, -0.631558, -0.817281, 0.142117, 0.649301, -0.685559, 0.317358, -0.816128, 0.896987, -0.808449, -0.141181, 0.254, 0.540822, -0.053505, -0.440647, -0.503204, -0.804487, 0.509112, 0.050405, 0.601983, -0.385832, 0.238291, 0.998461, 0.496045, 0.077139, -0.153403, -0.960801, 0.630448, -0.808006, -0.801654], \"shape\": [3, 3, 2, 4]}, {\"data\": [-0.83252, -0.332987, 0.718711, -0.788626], \"shape\": [4]}], \"expected\": {\"data\": [0.0, 0.565042, 0.12593, 0.0, 0.0, 0.320489, 0.979856, 0.0, 0.0, 0.0, 0.799525, 0.0, 0.0, 0.0, 0.637126, 0.0], \"shape\": [2, 2, 4]}}, \"convolutional.Conv2D.6\": {\"input\": {\"data\": [0.70412, 0.47762, 0.948863, 0.714924, 0.710821, 0.719052, -0.295442, -0.575936, 0.560889, 0.798823, -0.904521, -0.725105, -0.647339, -0.926505, 0.020986, 0.534159, -0.030523, -0.580772], \"shape\": [6, 3, 1]}, \"weights\": [{\"data\": [-0.98287, 0.908613, -0.10087, 0.220438, 0.70412, 0.47762, 0.948863, 0.714924, 0.710821, 0.719052, -0.295442, -0.575936, 0.560889, 0.798823, -0.904521, -0.725105, -0.647339, -0.926505, 0.020986, 0.534159, -0.030523, -0.580772, -0.162302, 0.128018, -0.216971, 0.026925, 0.392296, 0.991634, 0.214941, 0.639493, -0.574398, -0.430476, -0.117988, -0.261311, -0.808084, -0.466051], \"shape\": [3, 3, 1, 4]}, {\"data\": [-0.98287, 0.908613, -0.10087, 0.220438], \"shape\": [4]}], \"expected\": {\"data\": [0.0, 0.474708, 0.960876, 1.317228, 0.0, 2.040575, 0.0, 0.060188, 0.0, 2.127169, 0.77897, 0.632372, 0.0, 0.0, 0.462447, 0.405417], \"shape\": [2, 2, 4]}}, \"convolutional.Conv2D.7\": {\"input\": {\"data\": [-0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [0.08681, -0.443261, -0.150965, 0.689552, -0.990562, -0.756862, 0.341498, 0.651706, -0.726587, 0.150187, 0.782644, -0.581596, -0.629344, -0.783246, -0.560605, 0.957248, 0.623366, -0.656118, 0.632449, -0.451853, -0.136592, 0.88006, 0.635299, -0.327776, -0.649179, -0.254336, -0.988623, -0.495147, 0.591325, -0.96949, 0.197687, 0.207609, -0.789705, -0.236113, -0.927048, 0.780823, 0.961842, -0.880116, 0.781092, 0.153803, 0.484959, 0.260368, 0.163684, -0.959122, -0.579947, 0.08937, 0.53823, -0.49861, -0.428209, 0.70479, 0.950013, 0.769707, -0.280984, 0.197718, -0.290409, -0.31962, -0.643838, -0.524612, -0.910275, 0.010863, -0.247495, 0.185611, 0.259884, -0.714799, 0.867683, 0.89276, 0.204593, -0.224467, -0.273624, -0.591309, -0.44647, -0.506928], \"shape\": [3, 3, 2, 4]}, {\"data\": [0.08681, -0.443261, -0.150965, 0.689552], \"shape\": [4]}], \"expected\": {\"data\": [-0.449265, 0.56076, -2.92837, 1.056555], \"shape\": [1, 1, 4]}}, \"convolutional.Conv2D.8\": {\"input\": {\"data\": [0.303535, -0.150862, 0.313191, -0.581677, 0.319849, 0.059247, 0.497041, -0.812486, 0.569044, 0.374484, 0.390157, -0.006267, 0.950722, -0.592945, -0.401959, -0.544688, -0.903662, 0.807943, -0.839793, 0.214433, 0.261693, -0.244116, -0.973518, 0.684439, -0.230125, 0.103332, 0.421076, 0.350558, 0.389129, -0.315086, -0.175219, -0.520418, 0.937672, -0.422886, -0.705377, -0.741319, 0.888112, -0.297131, 0.467135, 0.827779, 0.401975, -0.222937, 0.884519, 0.472983, -0.523071, 0.647547, 0.521227, -0.210582, -0.599624, 0.425193], \"shape\": [5, 5, 2]}, \"weights\": [{\"data\": [0.032797, 0.141335, -0.943052, -0.656957, 0.370554, 0.667794, -0.386068, 0.787226, 0.443088, -0.620122, 0.108455, -0.295736, -0.636215, 0.571204, 0.930966, -0.535293, -0.832877, 0.207097, 0.457986, -0.447522, 0.370613, 0.035735, -0.903031, -0.724262, -0.626065, 0.988636, 0.041331, 0.157579, 0.469638, 0.083924, 0.826307, 0.61584, -0.194004, -0.285551, 0.905753, -0.312737, 0.7302, 0.660555, 0.076323, 0.844939, -0.805707, -0.794305, 0.403015, 0.78096, -0.680879, -0.448855, 0.344983, -0.671394, 0.402742, -0.02473, 0.361356, 0.043096, -0.913207, -0.552127, 0.15041, -0.759133, 0.000233, -0.723981, -0.894383, -0.643446, -0.115264, 0.755175, 0.898528, -0.043665, -0.077761, 0.274578, -0.350784, -0.764844, -0.897798, 0.275317, 0.624532, 0.340521], \"shape\": [3, 3, 2, 4]}], \"expected\": {\"data\": [-0.578839, 1.046696, 1.078234, 0.69352], \"shape\": [1, 1, 4]}}, \"convolutional.Conv2D.9\": {\"input\": {\"data\": [0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641, -0.221058, -0.27166, -0.014907, -0.92768, -0.54906, -0.731149, 0.600323, 0.352064, -0.730288, 0.065041, 0.53791, -0.398966, -0.180102, -0.233353, 0.95265, 0.076114, 0.820989, -0.637627, -0.434933, -0.836859, -0.781756, 0.2022, 0.420213, -0.359623, 0.460477, 0.643565, -0.143274, -0.63885, -0.803257, 0.287415], \"shape\": [7, 7, 2]}, \"weights\": [{\"data\": [0.195363, 0.351974, -0.401437, 0.461481, 0.157479, 0.618035, -0.665503, -0.37571, -0.284137, -0.016505, -0.019604, 0.78882, -0.635179, -0.277676, 0.621183, -0.333106, 0.037901, -0.47676, -0.738144, -0.755166, 0.103315, -0.941233, 0.20555, 0.501765, -0.501859, -0.604645, 0.147912, 0.803597, 0.032433, -0.197603, 0.034979, 0.874782, 0.700816, -0.648994, 0.039638, 0.011529, -0.302879, -0.858314, 0.151964, -0.196575, 0.82283, 0.617771, -0.735886, 0.429729, -0.306674, 0.228823, -0.425021, 0.971139, -0.455574, 0.638783, 0.199032, 0.44091, 0.91975, -0.814286, -0.088979, 0.765096, 0.395408, -0.357503, -0.275416, 0.467275, 0.245085, -0.563436, 0.96541, -0.199388, 0.43292, -0.389609, 0.298369, -0.25199, -0.266434, -0.949491, -0.303867, -0.024641], \"shape\": [3, 3, 2, 4]}, {\"data\": [0.195363, 0.351974, -0.401437, 0.461481], \"shape\": [4]}], \"expected\": {\"data\": [0.0, 2.241294, 0.0, 1.107507], \"shape\": [1, 1, 4]}}, \"convolutional.Conv2D.10\": {\"input\": {\"data\": [0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698], \"shape\": [4, 8, 3]}, \"weights\": [{\"data\": [-0.135778, -0.651569, -0.658113, 0.655264, 0.174343, -0.081293, 0.64537, 0.643096, -0.385759, -0.598211, -0.193535, 0.895779, 0.355089, 0.21795, 0.344727, -0.984035, -0.32688, -0.285455, -0.02788, 0.756565, 0.509817, 0.26093, -0.247033, 0.180323, 0.474657, 0.192293, -0.815041, -0.195458, 0.179373, -0.769174, -0.223611, -0.880477, 0.167916, -0.666549, -0.303809, -0.156202, -0.501052, 0.539906, 0.10262, -0.947416, 0.541952, -0.813565, 0.405592, 0.159078, 0.198436, 0.71454, 0.102339, -0.835312, 0.466992, 0.067715, -0.315822, -0.056778, -0.556856, -0.647049, -0.050928, -0.277526, 0.64888, -0.708, 0.639138, -0.632262, 0.126027, -0.751824, 0.387838, -0.924068, -0.411933, 0.793635, -0.432359, -0.568279, -0.942986, -0.929277, 0.746907, 0.954599, -0.470971, 0.887461, -0.919761, -0.423457, 0.359481, 0.23833, 0.4367, 0.136035, 0.837921, 0.01252, 0.76166, -0.067006, -0.569453, 0.707085, -0.685992, -0.972653, 0.424172, -0.023413, -0.494544, 0.239537, -0.357146, -0.832116, 0.911805, -0.493355, 0.799492, 0.907763, 0.590698, -0.657319, -0.899599, 0.66576, -0.026552, -0.808517, 0.761201, 0.060031, 0.911167, -0.541875, -0.052366, -0.677874, -0.540037, 0.858037, 0.841428, 0.664757, 0.159247, -0.408513, 0.157763, 0.953228, -0.419758, 0.13644, 0.857617, 0.935383, -0.725736, 0.482768, 0.919937, 0.516163, 0.078243, 0.504286, 0.149417, 0.153285, -0.686413, -0.515197, 0.529735, -0.671812, 0.737835, 0.760286, -0.825563, 0.862511, -0.185154, 0.436687, -0.452091, -0.048684, 0.142544, 0.590622], \"shape\": [4, 4, 3, 3]}, {\"data\": [-0.135778, -0.651569, -0.658113], \"shape\": [3]}], \"expected\": {\"data\": [1.131317, 0.0, 0.0, 0.809904, 0.0, 0.0, 0.056086, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.251846, 0.0, 0.650556, 0.628197, 0.0, 0.0, 1.029379, 0.0, 2.939306, 0.23459, 0.0, 0.385831, 0.0, 0.0, 1.017464, 0.18825, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.247988, 0.083916, 0.0, 0.0, 0.202801, 0.0, 0.137876, 1.309465, 0.0, 0.0, 0.969843, 0.531891, 0.0, 0.0, 0.06576, 0.0, 0.0, 0.0, 0.0, 0.096874, 0.0, 1.147747, 0.0, 0.0, 0.155811, 0.0, 0.331866, 0.0, 0.319746, 0.0, 0.0, 0.0, 0.0, 1.384199, 0.0, 1.856335, 0.0, 1.686605, 0.0, 0.0, 0.0, 0.0, 0.0, 1.802758, 0.0, 0.0, 0.0, 0.102891, 0.0, 0.0, 1.089357, 0.617667, 0.0, 0.0, 0.543751], \"shape\": [4, 8, 3]}}, \"convolutional.Conv2D.11\": {\"input\": {\"data\": [-0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234, -0.611808, 0.138739, 0.526129, -0.170329, 0.504868, -0.454139, 0.245234, 0.479283, 0.651594, -0.447885, -0.78716, -0.537367, -0.578885, -0.3999, -0.981424, 0.584097, -0.461375, 0.948907, 0.763872, -0.720626, -0.572361, 0.780094, -0.385637, 0.90998, -0.697513, 0.366373, -0.427147, 0.423096, -0.55829, 0.769474, -0.484912, -0.731131, -0.794623, 0.19042, 0.537997, -0.390004, -0.697993, -0.710914, -0.222541, -0.375822, 0.236956, -0.978421, -0.834872, 0.29127, 0.125375, 0.82053, 0.953645, 0.931806, 0.170904, -0.474968, -0.266042, -0.021253, 0.449315, 0.266589, 0.405989, 0.663497, 0.762836, -0.421562, 0.664906, 0.130767], \"shape\": [8, 8, 2]}, \"weights\": [{\"data\": [-0.704159, -0.543403, 0.614987, -0.403051, -0.628587, 0.544275, -0.189121, 0.991809, -0.028349, 0.30284, 0.201092, -0.953154, -0.343083, 0.640537, -0.117391, -0.526633, -0.163892, 0.861458, -0.665795, 0.51919, -0.753596, 0.337708, 0.402785, 0.315812, 0.541968, 0.870102, -0.141283, -0.469735, -0.574406, -0.571765, 0.046045, -0.790043, -0.953079, -0.774733, -0.58544, -0.882147, 0.282331, 0.214534, 0.862629, -0.446078, 0.230215, 0.308982, -0.361978, -0.850926, 0.409799, 0.710712, -0.391058, -0.542441, -0.41638, 0.558765, -0.149949, -0.864061, -0.759997, -0.265417, -0.331629, -0.845702, 0.426935, -0.731659, 0.062865, -0.255582, 0.396332, 0.639196, -0.078254, -0.253246, 0.792036, 0.044105, 0.879927, -0.987868, -0.35422, 0.924714, 0.304954, -0.870234], \"shape\": [3, 3, 2, 4]}, {\"data\": [-0.704159, -0.543403, 0.614987, -0.403051], \"shape\": [4]}], \"expected\": {\"data\": [1.008111, 0.862141, 1.53732, 0.0, 0.0, 0.0, 2.278924, 0.0, 0.192175, 0.256028, 1.00272, 0.0, 0.0, 0.0, 0.0, 1.28356, 0.0, 0.0, 1.295987, 0.0, 0.0, 0.0, 0.522589, 0.0, 0.0, 0.0, 1.593745, 0.0, 0.094799, 1.375385, 1.350499, 0.637961, 0.0, 0.393093, 1.508163, 1.045792, 0.0, 0.580916, 0.774659, 0.0, 0.0, 0.0, 1.090937, 0.2098, 0.0, 0.0, 0.706958, 0.948835, 0.0, 0.0, 0.70246, 1.233015, 0.0, 0.0, 0.0, 0.0, 0.0, 0.237716, 0.150121, 0.0, 0.012937, 1.067614, 0.259571, 0.895802, 0.0, 0.127769, 0.0, 0.0, 0.0, 0.0, 0.0, 0.517957, 0.0, 0.0, 0.524233, 0.079491, 0.0, 0.0, 0.0, 1.424679, 0.0, 0.0, 0.798433, 0.0, 0.752754, 0.49452, 0.564184, 1.320468, 0.0, 0.0, 1.469927, 0.075539, 0.0, 0.760117, 0.0, 0.961547, 0.938599, 1.264279, 0.857871, 0.0, 0.114331, 0.0, 0.753579, 0.0, 0.0, 0.0, 0.020539, 0.0, 0.0, 0.0, 1.035394, 0.0, 0.0, 0.0, 0.745973, 0.0, 0.0, 0.070491, 0.0, 0.0, 0.0, 0.0, 0.308166, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.911015, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.178493, 1.44698, 0.0, 0.0, 0.0, 1.45985, 0.298695, 0.0, 0.0, 0.0, 0.0, 0.0, 0.402046, 0.536043, 1.160239, 0.0, 0.0, 0.0, 0.0, 0.575623, 0.009206, 0.639194, 0.0, 0.353097, 0.0, 0.471996, 0.411527, 1.148312, 0.966958, 1.172197, 0.0, 0.419191, 0.0, 2.142206, 0.0, 0.0, 0.0, 0.0, 0.0, 0.508378, 0.0, 1.110668, 1.82902, 0.0, 0.0, 2.081267, 0.05382, 0.0, 0.0, 1.5163, 1.476838, 1.364327, 0.033732, 1.076706, 0.609169, 0.0, 0.149234, 2.181282, 0.780896, 0.0, 0.0, 0.763411, 0.0, 0.0, 0.0, 2.053607, 0.12022, 0.0, 0.0, 0.0, 0.29116, 0.0, 0.0, 0.656705, 0.0, 0.0, 0.0, 1.055828, 0.634612, 0.0, 0.0, 0.0, 0.363467, 1.779839, 0.0, 1.270641, 0.15881, 0.0, 0.020913, 0.854418, 0.0, 0.0, 0.0, 0.436751, 0.0, 0.0, 0.0, 0.0, 0.0, 0.436203, 0.236268, 0.0, 0.0, 0.0, 0.0, 0.189446, 0.0, 0.0, 0.0, 0.827813, 0.0, 0.0, 0.0, 0.31375, 0.0, 0.0, 0.0, 0.755046, 0.0], \"shape\": [8, 8, 4]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
